@layout("/common/_container.html",{plugins:["ztree"],js:["/assets/modular/task/timetask/timetask.js"]}){
<div class="layui-body-header">
    <span class="layui-body-header-title">定时任务管理</span>
</div>

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-sm12 layui-col-md12 layui-col-lg12">
            <div class="layui-card">
                <div class="layui-card-body">
                    <div class="layui-form toolbar">
                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <input id="timetaskName" class="layui-input" type="text" placeholder="定时任务名称"/>
                            </div>
                            <div class="layui-inline">
                                <button id="btnSearch" class="layui-btn icon-btn"><i class="layui-icon">&#xe615;</i>搜索</button>
                                @if(shiro.hasPermission("/timetask/add")){
                                <button id="btnAdd" class="layui-btn icon-btn"><i class="layui-icon">&#xe654;</i>添加</button>
                                @}
                                <button id="btnExp" class="layui-btn icon-btn"><i class="layui-icon">&#xe67d;</i>导出</button>
                            </div>
                        </div>
                    </div>
                    <table class="layui-table" id="timetaskTable" lay-filter="timetaskTable"></table>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/html" id="tableBar">
    @if(shiro.hasPermission("/timetask/edit")){
    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="edit">修改</a>
    @}
    {{# if(d.jobStatus =="1"){ }}
        {{# if(d.planStatus =="NONE"){ }}
            <a class="layui-btn layui-btn layui-btn-xs" lay-event="planJobAdd">计划</a>
        {{#  } }}
        {{# if(d.planStatus =="NORMAL"){ }}
            <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="planJobRun">立即执行</a>
            <a class="layui-btn layui-btn-warm  layui-btn-xs" lay-event="planJobStop">暂停</a>
            <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="planJobRemove">移除</a>
        {{#  } }}
        {{# if(d.planStatus =="PAUSED"){ }}
            <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="planJobRun">立即执行</a>
            <a class="layui-btn layui-btn layui-btn-xs" lay-event="planJobAdd">计划</a>
            <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="planJobRemove">移除</a>
        {{#  } }}
        {{# if(d.planStatus =="COMPLETE"){ }}
            <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="planJobRun">立即执行</a>
            <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="planJobRemove">移除</a>
        {{#  } }}
        {{# if(d.planStatus =="BLOCKED"){ }}
            <a class="layui-btn layui-btn-warm  layui-btn-xs" lay-event="planJobStop">暂停</a>
            <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="planJobRemove">移除</a>
        {{#  }else{ }}

                {{# d.planStatus}}

        {{#  } }}
   {{#  }else { }}
        @if(shiro.hasPermission("/timetask/delete")){
        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="delete">删除</a>
        @}
   {{#  } }}
</script>

<script type="text/html" id="statusTpl">
    <input type="checkbox" lay-filter="jobStatus" value="{{d.taskId}}" lay-skin="switch" lay-text="启动|禁用" {{d.jobStatus=='1'?'checked':''}} />
</script>
@}
